<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
</head>
<style>
    html, body {
        width: 100%;
        height: 100%;
        padding: 0;
        margin:0;
    }

    header {
        display: flex;
        align-items: center;
        height: 80px;
        padding-left: 360px;
        box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.1);
    }

    .round {
        width: 36px;
        height: 36px;
        background: #0065F0;
        border-radius: 50%;
    }

.login1{
    text-align: center;
}
    #main {
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 50px auto 50px;
    }
    .all_div{
        width: 246px;
        height: 246px;
        line-height: 246px;
        background: rgba(0,0,0,0.8);
        z-index: 100;
        opacity: 0.9;
        margin-top: -246px;
        color: #FFF;
        cursor: pointer;
        display: none;
    }
</style>
<body>
<header>
    <!--<div class="round"><img src="{$logo}" width="36" height="36"></div>-->
    <!--<div class="logo-word">LOGO</div>-->
</header>
<br/><br/>
<div class="login1">
    <span style="font-size: 30px;color: gray;">扫码登录</span>
</div>
<div id="main">
    <div class="form">
        <div class="login1">
            <img src="{$ercode}" id="img" style="width: 246px;height: 246px;" />
            <div class="all_div" style="">
                二维码失效，点击刷新
            </div>
        </div>
    </div>
</div>

<input type="hidden" id="code" value="{$code}" />
</body>
</html>
<script src="/static/admin/js/jquery.min.js"></script>
<script>
    settime();
    function settime() {
        var code = $('#code').val();
        $.ajax({
            url:"{:url('shop/Login/waitApp')}",
            type:'post',
            data:'code='+code,
            dataType:'json',
            success:function(res){
                if(res.status == 200){
                    window.location.href = res.msg;
                    return false;
                }else if(res.status == 100){
                    $('.all_div').css('display','block');
                    return false;
                }else if(res.status == 199){
                    setTimeout(function() {
                        settime()
                    },1000)
                }else{
                    alert(res.msg);
                    return false;
                }
            }
        });
    }

$('.all_div').click(function () {
    location.reload();
});
    //防止页面后退
    history.pushState(null, null, document.URL);
    window.addEventListener('popstate', function () {
        history.pushState(null, null, document.URL);
    });
</script>